<!-- saved from url=(0014)about:internet -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>main.mxml</title>
<link rel="stylesheet" type="text/css" href="../SourceStyles.css"/>
</head>

<body><pre><span class="MXMLProcessing_Instruction">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;</span>
<span class="MXMLComponent_Tag">&lt;mx:Application</span><span class="MXMLDefault_Text"> xmlns:mx=&quot;</span><span class="MXMLString">http://www.adobe.com/2006/mxml</span><span class="MXMLDefault_Text">&quot; layout=&quot;</span><span class="MXMLString">absolute</span><span class="MXMLDefault_Text">&quot;
    creationComplete=&quot;</span><span class="ActionScriptDefault_Text">init</span><span class="ActionScriptBracket/Brace">()</span><span class="MXMLDefault_Text">&quot;
    backgroundColor=&quot;</span><span class="MXMLString">0x333333</span><span class="MXMLDefault_Text">&quot; viewSourceURL=&quot;</span><span class="MXMLString">srcview/index.html</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">&gt;</span>
<span class="MXMLSpecial_Tag">&lt;mx:Script&gt;</span>
<span class="ActionScriptOperator">&lt;!</span><span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptDefault_Text">CDATA</span><span class="ActionScriptBracket/Brace">[</span>
<span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">as3isolib</span>.<span class="ActionScriptDefault_Text">display</span>.<span class="ActionScriptDefault_Text">primitive</span>.<span class="ActionScriptDefault_Text">IsoBox</span>;
<span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">as3isolib</span>.<span class="ActionScriptDefault_Text">display</span>.<span class="ActionScriptDefault_Text">scene</span>.<span class="ActionScriptDefault_Text">IsoScene</span>;
<span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">as3isolib</span>.<span class="ActionScriptDefault_Text">display</span>.<span class="ActionScriptDefault_Text">scene</span>.<span class="ActionScriptDefault_Text">IsoGrid</span>;
<span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">as3isolib</span>.<span class="ActionScriptDefault_Text">display</span>.<span class="ActionScriptDefault_Text">IsoSprite</span>;
<span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">as3isolib</span>.<span class="ActionScriptDefault_Text">enum</span>.<span class="ActionScriptDefault_Text">RenderStyleType</span>;
<span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">flash</span>.<span class="ActionScriptDefault_Text">display</span>.<span class="ActionScriptDefault_Text">Sprite</span>;

<span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">init</span><span class="ActionScriptBracket/Brace">()</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span><span class="ActionScriptBracket/Brace">{</span>
    <span class="ActionScriptDefault_Text">setScene</span><span class="ActionScriptBracket/Brace">()</span>;
    <span class="ActionScriptDefault_Text">setText</span><span class="ActionScriptBracket/Brace">()</span>;
    <span class="ActionScriptDefault_Text">setBox</span><span class="ActionScriptBracket/Brace">()</span>;
<span class="ActionScriptBracket/Brace">}</span>

<span class="ActionScriptComment">//シーンの作成
</span><span class="ActionScriptReserved">private</span> <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">scene</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">IsoScene</span>;
<span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">setScene</span><span class="ActionScriptBracket/Brace">()</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span><span class="ActionScriptBracket/Brace">{</span>
    <span class="ActionScriptDefault_Text">scene</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">IsoScene</span><span class="ActionScriptBracket/Brace">()</span>;
    <span class="ActionScriptDefault_Text">scene</span>.<span class="ActionScriptDefault_Text">hostContainer</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">myUI</span>;    
<span class="ActionScriptBracket/Brace">}</span>
<span class="ActionScriptComment">//文字を描写
</span><span class="ActionScriptReserved">private</span> <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">bd</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">BitmapData</span>;
<span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">setText</span><span class="ActionScriptBracket/Brace">()</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span><span class="ActionScriptBracket/Brace">{</span>
    <span class="ActionScriptDefault_Text">bd</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">BitmapData</span><span class="ActionScriptBracket/Brace">(</span> <span class="ActionScriptDefault_Text">myTxt</span>.<span class="ActionScriptDefault_Text">width</span> , <span class="ActionScriptDefault_Text">myTxt</span>.<span class="ActionScriptDefault_Text">height</span> <span class="ActionScriptBracket/Brace">)</span>;
    <span class="ActionScriptDefault_Text">bd</span>.<span class="ActionScriptDefault_Text">draw</span><span class="ActionScriptBracket/Brace">(</span> <span class="ActionScriptDefault_Text">myTxt</span> <span class="ActionScriptBracket/Brace">)</span>;
<span class="ActionScriptBracket/Brace">}</span>

<span class="ActionScriptComment">//箱を作成
</span><span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">setBox</span><span class="ActionScriptBracket/Brace">()</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span><span class="ActionScriptBracket/Brace">{</span>
    <span class="ActionScriptDefault_Text">scene</span>.<span class="ActionScriptDefault_Text">removeAllChildren</span><span class="ActionScriptBracket/Brace">()</span>;
    <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">w</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">int</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">bd</span>.<span class="ActionScriptDefault_Text">width</span>; 
    <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">h</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">int</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">bd</span>.<span class="ActionScriptDefault_Text">height</span>;
    <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">size</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">int</span> <span class="ActionScriptOperator">=</span> 20;
    <span class="ActionScriptReserved">for</span><span class="ActionScriptBracket/Brace">(</span> <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">i</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">int</span> <span class="ActionScriptOperator">=</span> 1 ; <span class="ActionScriptDefault_Text">i</span> <span class="ActionScriptOperator">&lt;</span> <span class="ActionScriptDefault_Text">w</span> ; <span class="ActionScriptDefault_Text">i</span><span class="ActionScriptOperator">++</span> <span class="ActionScriptBracket/Brace">){</span>
        <span class="ActionScriptReserved">for</span><span class="ActionScriptBracket/Brace">(</span> <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">j</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">int</span> <span class="ActionScriptOperator">=</span> 1 ; <span class="ActionScriptDefault_Text">j</span> <span class="ActionScriptOperator">&lt;</span> <span class="ActionScriptDefault_Text">h</span> ; <span class="ActionScriptDefault_Text">j</span><span class="ActionScriptOperator">++</span> <span class="ActionScriptBracket/Brace">){</span>
            <span class="ActionScriptReserved">if</span><span class="ActionScriptBracket/Brace">(</span> <span class="ActionScriptDefault_Text">bd</span>.<span class="ActionScriptDefault_Text">getPixel</span><span class="ActionScriptBracket/Brace">(</span> <span class="ActionScriptDefault_Text">i</span> , <span class="ActionScriptDefault_Text">j</span> <span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptOperator">!=</span> 0<span class="ActionScriptDefault_Text">xffffff</span> <span class="ActionScriptBracket/Brace">){</span>
                <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">box</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">IsoBox</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">IsoBox</span><span class="ActionScriptBracket/Brace">()</span>;
<span class="ActionScriptComment">//                box.styleType = RenderStyleType.SHADED
</span><span class="ActionScriptComment">//                box.faceColors = [0xff0000, 0x00ff00, 0x0000ff, 0xff0000, 0x00ff00, 0x0000ff]
</span><span class="ActionScriptComment">//              box.faceAlphas = [.5, .5, .5, .5, .5, .5];
</span>                <span class="ActionScriptDefault_Text">box</span>.<span class="ActionScriptDefault_Text">setSize</span><span class="ActionScriptBracket/Brace">(</span> <span class="ActionScriptDefault_Text">size</span>,<span class="ActionScriptDefault_Text">size</span>,<span class="ActionScriptDefault_Text">size</span><span class="ActionScriptBracket/Brace">)</span>;
                <span class="ActionScriptDefault_Text">box</span>.<span class="ActionScriptDefault_Text">moveTo</span><span class="ActionScriptBracket/Brace">(</span> <span class="ActionScriptDefault_Text">i</span> <span class="ActionScriptOperator">*</span> <span class="ActionScriptDefault_Text">size</span> , <span class="ActionScriptDefault_Text">j</span> <span class="ActionScriptOperator">*</span> <span class="ActionScriptDefault_Text">size</span> , 0 <span class="ActionScriptBracket/Brace">)</span>;
                <span class="ActionScriptDefault_Text">scene</span>.<span class="ActionScriptDefault_Text">addChild</span><span class="ActionScriptBracket/Brace">(</span> <span class="ActionScriptDefault_Text">box</span> <span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptBracket/Brace">}</span>
        <span class="ActionScriptBracket/Brace">}</span>
    <span class="ActionScriptBracket/Brace">}</span>
    <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">grid</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">IsoGrid</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">IsoGrid</span><span class="ActionScriptBracket/Brace">()</span>;
    <span class="ActionScriptDefault_Text">grid</span>.<span class="ActionScriptDefault_Text">showOrigin</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">true</span>;
<span class="ActionScriptComment">//    grid.styleType = RenderStyleType.SHADED;
</span><span class="ActionScriptComment">//    grid.faceColors = [0xff0000, 0x00ff00, 0x0000ff, 0xff0000, 0x00ff00, 0x0000ff]
</span>    <span class="ActionScriptDefault_Text">grid</span>.<span class="ActionScriptDefault_Text">cellSize</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">size</span>;
    <span class="ActionScriptDefault_Text">grid</span>.<span class="ActionScriptDefault_Text">setGridSize</span><span class="ActionScriptBracket/Brace">(</span>200,200,200<span class="ActionScriptBracket/Brace">)</span>;
    <span class="ActionScriptDefault_Text">scene</span>.<span class="ActionScriptDefault_Text">addChild</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">grid</span><span class="ActionScriptBracket/Brace">)</span>;    
    <span class="ActionScriptDefault_Text">scene</span>.<span class="ActionScriptDefault_Text">render</span><span class="ActionScriptBracket/Brace">()</span>;    
<span class="ActionScriptBracket/Brace">}</span>

<span class="ActionScriptComment">//文字再描画
</span><span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">onChange</span><span class="ActionScriptBracket/Brace">()</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span><span class="ActionScriptBracket/Brace">{</span>
    <span class="ActionScriptDefault_Text">setText</span><span class="ActionScriptBracket/Brace">()</span>;
    <span class="ActionScriptDefault_Text">setBox</span><span class="ActionScriptBracket/Brace">()</span>;    
<span class="ActionScriptBracket/Brace">}</span>        
<span class="ActionScriptBracket/Brace">]]</span><span class="ActionScriptOperator">&gt;</span>
<span class="MXMLSpecial_Tag">&lt;/mx:Script&gt;</span>
<span class="MXMLComponent_Tag">&lt;mx:UIComponent</span><span class="MXMLDefault_Text"> id=&quot;</span><span class="MXMLString">myUI</span><span class="MXMLDefault_Text">&quot; width=&quot;</span><span class="MXMLString">500</span><span class="MXMLDefault_Text">&quot; height=&quot;</span><span class="MXMLString">500</span><span class="MXMLDefault_Text">&quot; verticalCenter=&quot;</span><span class="MXMLString">0</span><span class="MXMLDefault_Text">&quot; horizontalCenter=&quot;</span><span class="MXMLString">0</span><span class="MXMLDefault_Text">&quot; </span><span class="MXMLComponent_Tag">/&gt;</span>
<span class="MXMLComponent_Tag">&lt;mx:Canvas</span><span class="MXMLDefault_Text"> x=&quot;</span><span class="MXMLString">10</span><span class="MXMLDefault_Text">&quot; y=&quot;</span><span class="MXMLString">10</span><span class="MXMLDefault_Text">&quot; width=&quot;</span><span class="MXMLString">248</span><span class="MXMLDefault_Text">&quot; height=&quot;</span><span class="MXMLString">47</span><span class="MXMLDefault_Text">&quot;
    backgroundColor=&quot;</span><span class="MXMLString">0xffffff</span><span class="MXMLDefault_Text">&quot; backgroundAlpha=&quot;</span><span class="MXMLString">0.8</span><span class="MXMLDefault_Text">&quot;
    cornerRadius=&quot;</span><span class="MXMLString">10</span><span class="MXMLDefault_Text">&quot; borderColor=&quot;</span><span class="MXMLString">0xcccccc</span><span class="MXMLDefault_Text">&quot; borderStyle=&quot;</span><span class="MXMLString">solid</span><span class="MXMLDefault_Text">&quot; borderThickness=&quot;</span><span class="MXMLString">3</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">&gt;</span>
    <span class="MXMLComponent_Tag">&lt;mx:TextInput</span><span class="MXMLDefault_Text"> id=&quot;</span><span class="MXMLString">myTxt</span><span class="MXMLDefault_Text">&quot; x=&quot;</span><span class="MXMLString">10</span><span class="MXMLDefault_Text">&quot; y=&quot;</span><span class="MXMLString">10</span><span class="MXMLDefault_Text">&quot; text=&quot;</span><span class="MXMLString">ハルヒ</span><span class="MXMLDefault_Text">&quot;
        borderThickness=&quot;</span><span class="MXMLString">0</span><span class="MXMLDefault_Text">&quot; borderColor=&quot;</span><span class="MXMLString">0xffffff</span><span class="MXMLDefault_Text">&quot; borderStyle=&quot;</span><span class="MXMLString">solid</span><span class="MXMLDefault_Text">&quot;
        enter=&quot;</span><span class="ActionScriptDefault_Text">onChange</span><span class="ActionScriptBracket/Brace">()</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">/&gt;</span>
    <span class="MXMLComponent_Tag">&lt;mx:Button</span><span class="MXMLDefault_Text"> x=&quot;</span><span class="MXMLString">178</span><span class="MXMLDefault_Text">&quot; y=&quot;</span><span class="MXMLString">10</span><span class="MXMLDefault_Text">&quot; label=&quot;</span><span class="MXMLString">描画</span><span class="MXMLDefault_Text">&quot; click=&quot;</span><span class="ActionScriptDefault_Text">onChange</span><span class="ActionScriptBracket/Brace">()</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">/&gt;</span>
<span class="MXMLComponent_Tag">&lt;/mx:Canvas&gt;</span>

<span class="MXMLComponent_Tag">&lt;/mx:Application&gt;</span></pre></body>
</html>
